package com.zjitc.controller;/**
 * Create by IntelliJ IDEA
 *
 * @author: MaoYongQi
 * @date-Time: 2018/4/2 11:28
 * @description:
 */

import com.zjitc.common.ServerResponse;
import com.zjitc.model.Shipping;
import com.zjitc.service.ShippingService;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Create by IntelliJ IDEA
 *
 * @author: MaoYongQi
 * @date-Time: 2018/4/2 11:28
 * @description:
 */

@Controller
@RequestMapping("/shipping")
public class ShippingController {

  @Autowired
  private ShippingService service;


  @RequestMapping("/add")
  @ResponseBody
  public ServerResponse<Shipping> add(Shipping shipping) {
    return service.add(shipping);
  }


  @RequestMapping("/del")
  @ResponseBody
  public ServerResponse<Shipping> del(String shippingId){
    return service.del(shippingId);
  }


  @RequestMapping("/update")
  @ResponseBody
  public ServerResponse<Shipping> update(Shipping shipping){
    return service.update(shipping);
  }

  @RequestMapping("/select")
  @ResponseBody
  public ServerResponse<Shipping> select(String shippingId,HttpSession session){
    return service.select(shippingId,session);
  }

  @RequestMapping("/list")
  @ResponseBody
  public ServerResponse<Shipping> list(
      @RequestParam(value = "pageNum",required = false,defaultValue = "1")Integer pageNum,
      @RequestParam(value = "pageSize",required = false,defaultValue = "10")Integer pageSize,
      HttpSession session
  ){
    return service.selectList(pageNum,pageSize,session);
  }

}
